var current_times=new Date().getTime();
function g_tile(title,color,src,site){
	var val='<div class="tile ';
	if(color!=null){
	val+='bg-color-'+color+' ';
	}
	if(src==null){
		val+='"><div class="brand"><div class="name';
		if(color=='white'){
			val+=' fg-color-darken"';
		}
		val+='">'+title+'</div></div></div>';
	}else{
		if(site==null){
			site=script_url+'images/';
		}
		val+='image"><div class="tile-content"><img src="'+site+
		src+'"></div><div class="brand"><div class="name">'+title+'</div></div></div>';
	}
	return val;
}
function ajax_it(data,url){
	if(data==null){
		data='';
	}
	if(url==null){
		url='';
	}
	$.ajax({
		url: site_url+url,
		type: "POST",
		data: data,
		cache: false,
		success: function (data) {
		}
	})
}
function c(obj,num){
	$(obj).attr('src',script_url+'images/dig'+num+'.gif');
}
var sec=0;
function setsec(){
	if(sec>0){
		data='sec='+encodeURIComponent((sec*10));
		data+='&ct='+encodeURIComponent((current_times));
		ajax_it(data,"sec");
	}
	sec++;
	setTimeout("setsec()",10000);
}
function span_dance(){
	$('#span1').css({
		'margin':'0',
		'padding':'0',
		'top':'0',
		'right':'0',
	});
	$('#span1').animate({
		display: 'block',
		top:0,
		height: '100%'
	},"slow").animate({
		height: '20px'
	},"slow").animate({
		width: '100%',
		right:0
	},"slow").animate({
		width: '0',
		left:0
	},"slow");
}

function span_dance2(){
	$('#span2').css({
		'margin':'0',
		'padding':'0',
		'top':'0',
		'right':'0',
	});
	$('#span2').animate({
		display: 'block',
		top:0,
		width:'20px',
		opacity:.75,
		height: '100%'
	},"slow").animate({
		height: '20px',
		opacity:.5,
		top:($(window).height()-20)+'px'
	},"slow",function (){
		var someajaxtext='WilzoKCH.com   ';
		dv=$('#span2');
		dv.css({
			'color':'white',
			'text-align':'right',
			'font-size':'14px'
		});
		jQuery({
			count: 0
		}).animate({
			count: someajaxtext.length
		}, {
			duration: 500,
			step: function () {
				dv.html(someajaxtext.substring(0, Math.round(this.count)));
			}
		});
	}).animate({
		width: '100%',
		height: '30px',
		'padding-right':($(window).width()-100)+'px',
		top:($(window).height()-31)+'px',
		opacity:.25,
		right:0,
		'font-size':'30px'
	},"slow").animate({
		width: '0',
		opacity:0,
		right:($(window).width())+'px'
	},"slow");
}
function texting(dv,someajaxtext){
	dv.html("&nbsp");
	$('#mar_span1').html(title[cur]);
	$('#mar_span2').html(title[cur]);
	$('#mar_span3').html(title[cur]);
	$('#compatible_img').fadeIn();
    jQuery({
        count: 0
    }).animate({
        count: someajaxtext.length
    }, {
        duration: 1500,
        step: function () {
            dv.html(someajaxtext.substring(0, Math.round(this.count)));
        }
    });
}
function change_height(){
	$('#hidebar2').animate({height: ($(window).height()-$('#hidebar2').offset().top)+'px'},"normal");
	setTimeout(function() {
		$('#hidebar2').animate({height: ($(window).height()-$('#hidebar2').offset().top)+'px'},"slow",function(){		
			if($(window).width()<600){
				$('.dropdown-menu').css('position','absolute');
				$('#hidebar2').animate({
					height:'100%'
				});
			}else{
				$('.dropdown-menu').css('position','relative');
				$('#hidebar2').css({height: ($(window).height()-$('#hidebar2').offset().top)+'px'});
			}
		});
	}, 800);
	
}
function page_reset(){
	$('#wz-title').html('');
	$('#wz-desc').html('');
	$('#hidebar').css({
		'position':'relative',
		'height':'0',
		'width':'0',
		'opacity':'0'
	});
	$('#hidebar2').css({
		'position':'relative',
		'height':'0',
		'opacity':'0'
	});
}
function page_init() {
	page_reset();
	$('#facebook_c').add('#facebook_c>span').add('#facebook_c>iframe').css({
		height: ($(window).height()-$('.close-charms').outerHeight()-$('.close-charms').offset().top-150)+'px'
	}).attr("data-height",($(window).height()-$('.close-charms').outerHeight()-$('.close-charms').offset().top-150));
	$('.nav-bar').css('opacity','.6').fadeIn("fast");
	if($('#hidebar2').length){
		$('#about_t').children().each(function(i) {
			$(this).css({
				// 'position':'relative',
				// 'z-index':'999999'
			});
		});
		$('#hidebar2').css('height','0');
		$('.menu').children().css('display','none');
		$('#hidebar').animate({
			height: '+=50',
			width: '100%',
			opacity: '+=1',
			padding:0
		},"slow", function() {
			$('#hidebar2').animate({
				height: ($(window).height()-$('#hidebar2').offset().top)+'px',
				opacity: '+=1'
			},"slow",function(){
				$('#hidebar').css({height:'auto'});
				$('#hidebar2').css({height: ($(window).height()-$('#hidebar2').offset().top)+'px'});
				$('.menu').children().each(function(i) {
					var dobj=this;
					setTimeout(function() {
						$(dobj).css('display','inline-block').fadeOut("fast").fadeIn("slow");
					}, 500*i);
				});
				texting($('#wz-title'),title[cur]);
				texting($('#wz-desc'),desc[cur]);
				span_dance2();
			});
		});
	}else{
		$('#wz-page').css('height' ,($(window).height()-$('#wz-page').offset().top)+'px');
	}
	$('.app-bar>a').css('display','none');
	$('.app-bar').animate({
		display: 'none',
		opacity: '0'
	},"fast");
	$("a").click(function (e) {
		e.preventDefault();
	});
	if($(window).width()<600){
		$('.dropdown-menu').css('position','absolute');
		$('#hidebar2').animate({
			height:'100%'
		});
	}else{
		$('.dropdown-menu').css('position','relative');
	}
}
function false_reload(){
	span_dance();
	page_init();
}
function wz_alert(msg,className,msgType){
	if(className==null||className==''){
		msgType='message-dialog';
	}
	if(className!=null){
		$('#wz-dialog').attr('class',msgType+' '+className);
	}else{
		$('#wz-dialog').attr('class','message-dialog bg-color-blueLight');
	}
	$('#wz-dialog').css('z-index',101);
	if($('#wz-dialog').css('display')!='block'){
	$('#wz-dialog').fadeIn()
	}
	if(msg==1030){
	msg=filename;
	}
	$('#wz-msg').html(msg);
	data='msg='+encodeURIComponent(msg);
	ajax_it(data,"msg");
}
function change_content(num){
	cur=num;
	$('#mar_span1').html('');
	$('#mar_span2').html('');
	$('#mar_span3').html('');
	false_reload();
	data='title='+encodeURIComponent(title[cur]);
	ajax_it(data,"data"+num);
	// texting($('#wz-title'),title[num]);
	// texting($('#wz-desc'),desc[num]);
}
function noContextMenu() {
	$("#charms").charms('close');
	if($('.app-bar').css('opacity')>0){
		$('.app-bar>a').css('display','none');
		$('.app-bar').animate({
			display: 'none',
			opacity: '0'
		},"slow");
		data='action='+encodeURIComponent('close');
	}else{
		$('.app-bar>a').css('display','inline-block');
		$('.app-bar').animate({
			display: 'block',
			opacity: '+=1'
		},"slow");
		data='action='+encodeURIComponent('open');
	}
	ajax_it(data,"rightclick");
	return false;
}
document.onContextMenu=noContextMenu;